<?php

namespace app\system\controller;

use app\system\model\PostModel;
use think\App;

class Post extends Base
{
    private $postModel;

    public function __construct(App $app)
    {
        parent::__construct($app);
        $this->postModel = new PostModel();
    }

    public function list()
    {
        $param = $this->request->param();
        $info = $this->postModel->paginate([
            'page'=>$param['pageNum'],
            'list_row'=>$param['pageSize']
        ])->toArray();

        $returnData = [
            'code'=> 200,
            'msg'=> '操作成功',
            'rows'=> $info['data'],
            'total'=> $info['total']
        ];
        return json($returnData);
    }

    public function export()
    {

    }

    public function getInfo()
    {

    }

    public function add()
    {
        $data = $request->param();
        $this->postModel->save($data);
    }

    public function edit()
    {

    }

    public function remove()
    {

    }

    public function optionselect()
    {

    }

}